package demo;

import java.util.Date;

import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;

import util.AppUtil;

public class MyApplicationContextInitializer implements ApplicationContextInitializer {
     @Override
     public void initialize(ConfigurableApplicationContext applicationContext) { 
         System.out.println(this.getClass().getSimpleName()+" run "+new Date());
         System.out.println("applicationContext="+applicationContext);
         System.out.println("environment="+applicationContext.getEnvironment());
         // 可以在这里 把 applicationContext 和  environment 注入到静态工具类里
         AppUtil.setApplicationContext(applicationContext);
     }
 }